package com.umeng.analytics.pro;

import android.content.Context;
import android.text.TextUtils;
import java.io.File;

public class ai extends y {
    private static final String a = "oldumid";
    private Context b;
    private String c;
    private String d;

    public ai(Context arg3) {
        super("oldumid");
        this.c = null;
        this.d = null;
        this.b = arg3;
    }

    private void b(String arg3) {
        File v0 = new File(arg3);
        if(!v0.exists()) {
            v0.mkdirs();
        }
    }

    public String f() {
        return this.c;
    }

    public boolean g() {
        return this.h();
    }

    public boolean h() {
        boolean v0 = true;
        this.d = af.a(this.b).b().g(null);
        if(!TextUtils.isEmpty(this.d)) {
            this.d = bt.c(this.d);
            String v1 = bw.b(new File("/sdcard/Android/data/.um/sysid.dat"));
            String v2 = bw.b(new File("/sdcard/Android/obj/.um/sysid.dat"));
            String v3 = bw.b(new File("/data/local/tmp/.um/sysid.dat"));
            if(TextUtils.isEmpty(((CharSequence)v1))) {
                this.l();
            }
            else if(!this.d.equals(v1)) {
                this.c = v1;
                return v0;
            }

            if(TextUtils.isEmpty(((CharSequence)v2))) {
                this.k();
            }
            else if(!this.d.equals(v2)) {
                this.c = v2;
                return v0;
            }

            if(TextUtils.isEmpty(((CharSequence)v3))) {
                this.j();
                return false;
            }

            if(this.d.equals(v3)) {
                return false;
            }

            this.c = v3;
        }
        else {
            v0 = false;
        }

        return v0;
    }

    public void i() {
        try {
            this.l();
            this.k();
            this.j();
        }
        catch(Exception v0) {
        }
    }

    private void j() {
        try {
            this.b("/data/local/tmp/.um");
            bw.a(new File("/data/local/tmp/.um/sysid.dat"), this.d);
        }
        catch(Throwable v0) {
        }
    }

    private void k() {
        try {
            this.b("/sdcard/Android/obj/.um");
            bw.a(new File("/sdcard/Android/obj/.um/sysid.dat"), this.d);
        }
        catch(Throwable v0) {
        }
    }

    private void l() {
        try {
            this.b("/sdcard/Android/data/.um");
            bw.a(new File("/sdcard/Android/data/.um/sysid.dat"), this.d);
        }
        catch(Throwable v0) {
        }
    }
}

